package org.zpmis.common.enums;


import org.zpmis.common.utils.StringUtil;

/**
 * @author LENOVO
 */
public enum LangEnum {
    /**
     * 国际化
     */
    EN("en", "美国","en","US"),
    CN("cn", "中国","zh","CN");
    private String code;
    private String message;
    private String language;
    private String area;

    LangEnum(String code, String message, String language, String area) {
        this.code = code;
        this.message = message;
        this.language = language;
        this.area = area;
    }

    public String code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }

    public String language() {
        return this.language;
    }

    public String area() {
        return this.area;
    }

    public static LangEnum getByCode(String code) {
        if(StringUtil.isEmpty(code)){
            return EN;
        }
        for (LangEnum langEnum : values()) {
            if (langEnum.code.equals(code)) {
                return langEnum;
            }
        }
        return EN;
    }

}